package com.itheima.day11.meFile.test7;

import java.io.File;

public class Test {
    public static void main(String[] args) {
        File file = new File("C:\\Users\\34564\\Desktop\\ccc");
        deleteDirectory(file);
        System.out.println("删除成功");

    }
    public static void deleteDirectory(File files){
        // 获得所有文件
        File[] file = files.listFiles();
        // 遍历
        for (File file1 : file) {
            if(file1.isFile()){
                file1.delete();
            }else{
                deleteDirectory(file1);
            }
        }
        files.delete();
    }
}
